<template>
    <div class="box5">
        <div class="title">
            <p>未来七天游客数量趋势图</p>
            <img src="../../images/dataScreen-title.png" alt="">
        </div>
        <div class="charts" ref="line"></div>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'

// 获取charts节点
let line = ref<any>()

onMounted(() => {
    // 获取charts类的实例
    let mycharts = echarts.init(line.value)
    // 设置实例配置项
    mycharts.setOption({
        // 标题组件
        title: {
            text: '访问量',
        },
        // x|y轴组件
        xAxis: {
            type: 'category',
            boundaryGap: false,
            splitLine: {
                show: false
            },
            data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日',],
            axisLine: {
                show: true
            },
            axisTick:{
                show:true
            }
        },
        yAxis: {
            splitLine: {
                show: false
            },
            axisLine: {
                show: true
            },
            axisTick:{
                show:true
            }
        },
        // 布局组件
        grid: {
            left: 40,
            right: 20,
            top: 0,
            bottom: 20
        },
        // 系列：决定展示什么样的图形
        series: [
            {
                type: 'line',
                data: [120, 1240, 66, 2299, 321, 890, 1200],
                smooth: true,
                areaStyle: {
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#67563A'
                        }, {
                            offset: 1, color: '#10164A'
                        }],
                        global: false
                    }
                }
            },

        ],

    })
})
</script>

<style lang="scss" scoped>
.box5 {
    width: 100%;
    height: 100%;
    background: url('../../images/dataScreen-main-cb.png') no-repeat;
    background-size: 100% 100%;
    margin: 0 20px;

    .title {
        margin-left: 10px;

        p {
            color: #fff;
            font-size: 20px;
        }
    }

    .charts {
        height: calc(100% - 40px);
    }
}
</style>